UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YQkilSplEW8mstc+Dt2Pkn+z0Fyw9DGGbqCOiupvQNk=' 
WHERE 
  key_id = '4fe038125843da8ffefeeb33f594749a1a03430061271937212187a6a23684e5' 
  AND (
    token = 'YQkilSplEW8mstc+Dt2Pkn+z0Fyw9DGGbqCOiupvQNk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025