UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DDdLmLz4bB/Rw+WYHKV9OiEwEBH8u3+rLorwutNeRag='
WHERE
key_id = 'eae71591d114416add655636dbb78c3f7e12ed708606f371c899b083976a361c'
AND (
token = 'DDdLmLz4bB/Rw+WYHKV9OiEwEBH8u3+rLorwutNeRag='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)