UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pIpRB2iX2Q2vDSHu0kBhFhiA5dBUAmVTBmlOGNr3AtY='
WHERE
key_id = '4f43b6bfdea6eb2045ee4343b3bfaab0581a834a077437c53a80393490db40f0'
AND (
token = 'pIpRB2iX2Q2vDSHu0kBhFhiA5dBUAmVTBmlOGNr3AtY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)