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