UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mWOuDqXfORiFVAjUPTqG80hDBYuwxUJfFKK7E3wCcRc=' 
WHERE 
  key_id = '8cafe6ab3d6ca4fbf6f146f2a3e164cf7b3d60cca31341eb608becb85ad3dc49' 
  AND (
    token = 'mWOuDqXfORiFVAjUPTqG80hDBYuwxUJfFKK7E3wCcRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046