UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd23qPx/vzbhZUGKr1ZuGBpOrMetn1unou0bNX88d8eI=' 
WHERE 
  key_id = 'be1db465702b3b0576884df27dbb144ba84ab74fa457e60e34f8677f56dc9e15' 
  AND (
    token = 'd23qPx/vzbhZUGKr1ZuGBpOrMetn1unou0bNX88d8eI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042