UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rIqI2BToxlFW7jZ2isUeUrarMhIWrNHpKu0qZWQgLHQ=' 
WHERE 
  key_id = '34539acb658f9c45fa479a209b3b671e92e7119936789d6d681300d271d117f6' 
  AND (
    token = 'rIqI2BToxlFW7jZ2isUeUrarMhIWrNHpKu0qZWQgLHQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041