UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WVrSmKZQ3eXzVG0T+yzDDiKsomc6hne0Z4yrf6RD+4k=' 
WHERE 
  key_id = '08c939c57fb2ff10099c5d5eee14156620beed678a21036f83d42ceff0e02611' 
  AND (
    token = 'WVrSmKZQ3eXzVG0T+yzDDiKsomc6hne0Z4yrf6RD+4k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044