UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p5b9N2D0K39BXeVKG4VL6PtsFwQtSqYAoiItWedyomc='
WHERE
key_id = '789c35519ba4094e1a920df240d743a48e2a258338a839b88eb490deaeaa2901'
AND (
token = 'p5b9N2D0K39BXeVKG4VL6PtsFwQtSqYAoiItWedyomc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)