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