UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yh6JdT8DHz/gRE6erNl14u24disw5mxo8CcFUdVuxX4='
WHERE
key_id = '79fcff0588fc87cdf5442aa5dff01b9149b59cee5c8d6eab39c55e74fc443e4b'
AND (
token = 'yh6JdT8DHz/gRE6erNl14u24disw5mxo8CcFUdVuxX4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)