UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0zkcd8uhSbctqlqyEpu1trD+fWaqqnKZYeBkpC9mMvk='
WHERE
key_id = 'dbd079ea7d57346aa32a90c1bbb561db94eee15cbd40eb0e6bf791ba16bd97fb'
AND (
token = '0zkcd8uhSbctqlqyEpu1trD+fWaqqnKZYeBkpC9mMvk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)