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