UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tsq3Jx2xUjIJpiuEiMMYTXKoqu09C0AqrH+oCOkr284='
WHERE
key_id = 'e8e878e0b3c67b045c9478fb7cee3a6f0b1325886d905306090e4e0fea69728d'
AND (
token = 'Tsq3Jx2xUjIJpiuEiMMYTXKoqu09C0AqrH+oCOkr284='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)