UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SHY9EBem5lmQ3RQ34yuTY0dfGJ/8f+QBocZmWGGwrY8='
WHERE
key_id = 'd8f8b37d9030161671883130e2931b725267de5794ad76ea645124f8fb61d686'
AND (
token = 'SHY9EBem5lmQ3RQ34yuTY0dfGJ/8f+QBocZmWGGwrY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)