UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RXbMvkaG4irmt4fQgd+zt44di300gSvrHFgILx7SdJI=' 
WHERE 
  key_id = 'd5aee25ba5f2e22504efb0cdd6166fc66242e94b25c9c08825661838e692999c' 
  AND (
    token = 'RXbMvkaG4irmt4fQgd+zt44di300gSvrHFgILx7SdJI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036