UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oTYLbMqUTYxqqa5cvPg3JX8dF0AE2mm+duBD4M2sp0o=' 
WHERE 
  key_id = 'a5ebd708a4c6f795adbd83c8f9fb4b79c082b2cbb0f05ddb91f97dd877eb6d4f' 
  AND (
    token = 'oTYLbMqUTYxqqa5cvPg3JX8dF0AE2mm+duBD4M2sp0o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035