UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x+cZbYYD5aJjSewdwC/ntLXdzfXRxAEWIP3ZsEUJSGA=' 
WHERE 
  key_id = 'a9db5679e6dfbe7eca3b64bde0ff4fbf50e40a2a1f654cf620b51a94bac42036' 
  AND (
    token = 'x+cZbYYD5aJjSewdwC/ntLXdzfXRxAEWIP3ZsEUJSGA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023