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