UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cEcQpBg5RARJk9jcZmxST8CrnJ1prUx0v1a77ioAYBw='
WHERE
key_id = 'ef0db1cc51ff64296afe0669c2f7acfc7f6a036c8bfea5fd6bcefe902a44816c'
AND (
token = 'cEcQpBg5RARJk9jcZmxST8CrnJ1prUx0v1a77ioAYBw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)