UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iDCMJYyARCY0yclHYVxi7sx15VrG4C6650ZRbgixPmg='
WHERE
key_id = '3ae77ff05cc6b2413b84f7025efaf42bb59e79ab2d0bffd7aefe4d629bff3ace'
AND (
token = 'iDCMJYyARCY0yclHYVxi7sx15VrG4C6650ZRbgixPmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)