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