UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SnmJvuerBF5qOd+ek/pFpkr8MTFV2M14a6XjYoILWTs='
WHERE
key_id = '0546263e76721082eb160b156880a82f2a76fb652de03cceba2f71593e0f3713'
AND (
token = 'SnmJvuerBF5qOd+ek/pFpkr8MTFV2M14a6XjYoILWTs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)