UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xx3amHKjkhPRayzELv87dEYOFELNYF0VYRTuu2Q8Jnk=' 
WHERE 
  key_id = '1449717687a1d662ca676325a1a1fc13b1349f1922e043014fdbe5f89f1df70b' 
  AND (
    token = 'Xx3amHKjkhPRayzELv87dEYOFELNYF0VYRTuu2Q8Jnk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034