UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nZmoZbFJEnzxw1xZ4y02s6P27lBXOGxgXhF0SsFcV/k='
WHERE
key_id = '32e0bdf690996e451489676584751e74a82170f455e58261b3aad63de099be8b'
AND (
token = 'nZmoZbFJEnzxw1xZ4y02s6P27lBXOGxgXhF0SsFcV/k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)