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