UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NWgAhOeYxnxLyYTsZ5Kpwrri8Mo2QLjERRhinXJYKIs='
WHERE
key_id = '46a4d410465c013a9679c3f1096d13e4321f0cb8ef8ef283af2c43010f4cd3af'
AND (
token = 'NWgAhOeYxnxLyYTsZ5Kpwrri8Mo2QLjERRhinXJYKIs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)