UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8OOmJzAttT/KN0YSqz1TpEPpthztlIV1nhd8dtDe5sg='
WHERE
key_id = '2f02f6fbb5e3bfce8400a5892575004817f1fe3005c446284d1165aeddbad335'
AND (
token = '8OOmJzAttT/KN0YSqz1TpEPpthztlIV1nhd8dtDe5sg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)