UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3XkLNCFRGzVb6Vahc5LPNNQEQFcFfK3N0ul1pRRlqcc='
WHERE
key_id = '8e9291f77d8cc6234813e47e9b5c193a5af1c2317f4dbf053083784d7e1d2d72'
AND (
token = '3XkLNCFRGzVb6Vahc5LPNNQEQFcFfK3N0ul1pRRlqcc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)