UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'odiAz05NJ7b9Ay5tUa1FO0+OYokjOM4+BVCucbgfYm8='
WHERE
key_id = '02ef970f22a25368dfc3bea7e71e863d8667ad5cb782f048d57ec08ec54e6fb3'
AND (
token = 'odiAz05NJ7b9Ay5tUa1FO0+OYokjOM4+BVCucbgfYm8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)