UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aUjHNj4lhklKaxpQhgzYzkOnv8ITZxVTsDXjU6u33zY='
WHERE
key_id = '6997afad7eb43e46412e6ac4561f40bf7ae012aca395d9160dffc21c9b7996cd'
AND (
token = 'aUjHNj4lhklKaxpQhgzYzkOnv8ITZxVTsDXjU6u33zY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)