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