UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6WIEtW+CRRirapqeX8DJJNFymXa8vsicnecgEg83PlA='
WHERE
key_id = 'fd0b03951858db7418f67c70b2c0434878f9f14f75c4803f841f41d279718efc'
AND (
token = '6WIEtW+CRRirapqeX8DJJNFymXa8vsicnecgEg83PlA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)