UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'u6MyZjG3WmHNQ6r9v6nIGRxyhon8vN8bRa7+PoEECfo='
WHERE
key_id = '8caa6bc4c6dcf35b9f9f428e4c04e0bc18062d64b357f094b3443966e223c4e7'
AND (
token = 'u6MyZjG3WmHNQ6r9v6nIGRxyhon8vN8bRa7+PoEECfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)