UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2E1llOk40Rh7o2hRTQRtnO66jc2KaucrWYzFkHPTbcQ=' 
WHERE 
  key_id = '6cca293a88c746522f30478fa192b81cf1b5cb8986b9d6216251823172831790' 
  AND (
    token = '2E1llOk40Rh7o2hRTQRtnO66jc2KaucrWYzFkHPTbcQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080