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