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