UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'adeE0e+eXVFMa/SAv/aj+PkMbeKrc7axNxcb0nPfIrE='
WHERE
key_id = '818b8b1aa2af0dde99c20339752d2255274510032f3187e151a8b366a8eccd77'
AND (
token = 'adeE0e+eXVFMa/SAv/aj+PkMbeKrc7axNxcb0nPfIrE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)