UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B3PG1LZ9NpJ8/w6GJCCd0EhvIyKEbTmsiMEg+fTPaT4=' 
WHERE 
  key_id = '3c6504e92239af5ab589c1e435e178b308444842d76be692695e0501f424a19a' 
  AND (
    token = 'B3PG1LZ9NpJ8/w6GJCCd0EhvIyKEbTmsiMEg+fTPaT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029