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