UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5GApaiuLb7ISr0k5qj44SjVzJO5DrlSfrtY5y+MbfUM='
WHERE
key_id = 'c4bfa36c1fb3163b395fb90e82808b1b317f3bc8b72dbe021bdae1f7a39051ad'
AND (
token = '5GApaiuLb7ISr0k5qj44SjVzJO5DrlSfrtY5y+MbfUM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)