UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bATHLMCRMWVlBNlF+Ml1ExRY1QKQuGyPSgWdAs7leh0=' 
WHERE 
  key_id = '5e1ed970b7684940951986eee922f21a7421a00082715491811229ecfba72e30' 
  AND (
    token = 'bATHLMCRMWVlBNlF+Ml1ExRY1QKQuGyPSgWdAs7leh0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038